package controllers

import (
	"read.com/admin/libs"
	"read.com/admin/models"
)

type AccountController struct {
	BaseController
}

func (self *AccountController) List() {
	self.Data["pageTitle"] = "账户管理记录"
	self.display()
}

func (self *AccountController) Table() {
	userId := self.GetString("userId")
	//列表参数
	page, err := self.GetInt("page")
	if err != nil {
		page = 1
	}
	limit, err := self.GetInt("limit")
	if err != nil {
		limit = 10
	}

	result,count,tableHead := models.GetAccountList(page,limit,userId,self.userId,self.userName)
	export := self.GetString("export")
	if export == "1" { // 导出excel格式
		libs.FormatExcel(self.Ctx.Output, result,tableHead)
	} else { // 查询
		self.ajaxList("成功", MSG_OK, count, result)
	}
}